package io.zhiller.koinbasictemplate.ui.screen

import android.content.Context
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import io.zhiller.koinbasictemplate.di.module.BasicFactory
import io.zhiller.koinbasictemplate.di.module.BasicSingleton
import io.zhiller.koinbasictemplate.di.viewmodel.BasicVM
import org.koin.androidx.compose.koinViewModel
import org.koin.compose.getKoin
import org.koin.core.parameter.parametersOf

@Composable
fun KoinScreen(
  context: Context
) {
  val basicVM = koinViewModel<BasicVM>()
  val basicFactory = getKoin().get<BasicFactory> {
    parametersOf("factory", 12)
  }
  val basicSingleton = getKoin().get<BasicSingleton>()

  Text(text = basicFactory.getData())
  Text(text = basicSingleton.getData())

  Text(text = basicVM.basicStates.name)
  Button(onClick = {
    basicVM.updateDataWithIndex(1)
  }) {
    Text("change vm")
  }
}